$input_direc = $ARGV[0];
chomp($input_direc);
open BUB, "< $input_direc/samples.txt" or die "can't open $input_direc/samples.txt\n";
open BUFF,"< $input_direc/sample.tped" or die "can't open file $input_direc/sample.tped\n";
#$filename = "chr10_phased.txt";
$line = <BUB>;
for($i=1;$i<23;$i++)
{
	$wrb = "WRBUFF$i";
	$fil = "chr$i"."_phased.txt";
	open($wrb,">$input_direc/$fil");
	print $wrb $line;

}
while($line = <BUFF>)
{
	chomp($line);
	@array = split(" ",$line);
	$wrb = "WRBUFF$array[0]";
	print $wrb $array[1]." ".$array[3];
	for($i=4;$i<@array;$i++)
	{
		print $wrb " $array[$i]";
	}
		print $wrb "\n";
}	

